﻿using System;
using Newtonsoft.Json.Linq;

namespace FBEntities.FBObjects
{
    public class FBMail : IFBObject
    {
        public FBFrom from;
        public string id;
        public string message;
        public string subject;
        public FBTo to;
        public DateTime updated_time;

        #region IFBObject Members

        public void Parse(JObject text)
        {
            FBParseUtilities.Parse(text, this);
        }

        #endregion

        public FBPost ToPost()
        {
            var ret = new FBPost
                      {
                          id = id,
                          from = from,
                          to = to,
                          name = subject,
                          description = message,
                          created_time = updated_time,
                          updated_time = updated_time,
                          type = "inbox"
                      };
            return ret;
        }
    }
}